package com.bwie.controller;

import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：ShenJiaFeng
 * @Package：com.bwie.controller
 * @Project：zg6_week11
 * @name：UserController
 * @Date：2024/4/25 9:21
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 根据姓名查询用户
     * @param userName
     * @return
     */
    @PostMapping("/findByUserName")
    public Result<User> findByUserName(@RequestParam String userName){
        return Result.success(
          userService.findByUserName(userName)
        );
    }

}
